//
// @Auther: by wujehy 
// @Email:wujehy@qq.com
// @Data:20-4-14
// @Time:上午11:06
//

#ifndef TESTSERVER_AUTHBUSINESS_H
#define TESTSERVER_AUTHBUSINESS_H

#include <handy/handy.h>
#include "BaseBusiness.h"

using namespace handy;

class AuthBusiness : public BaseBusiness
{
    friend BaseBusiness;

private:
    std::map<int, EventFunction> eventMap;

    static int Register(EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);

    static int Login(EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);

    static int LogOut(EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);

    static int HeartBeat(EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);

    static int ChangePassword(EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);


public:
//    AuthBusiness( int type_sub, int taskid, EventContext *context, uint8_t *protoData, int datalen, void *userdata = nullptr);

    AuthBusiness();

    int dispatchEvents(
            int type_sub, int taskid, const TcpConnPtr &con, uint8_t *protoData, int datalen, void *userdata) override;

    void setEvents() override;

    virtual ~AuthBusiness();
};


#endif //TESTSERVER_AUTHBUSINESS_H
